{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>投票系统</title>
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-color: #4361ee;
            --secondary-color: #3f37c9;
            --accent-color: #4895ef;
            --dark-color: #2b2d42;
            --light-color: #f8f9fa;
            --success-color: #4cc9f0;
            --danger-color: #f72585;
            --warning-color: #f8961e;
            --gray-color: #adb5bd;
        }
        
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        
        body {
            font-family: 'Noto Sans SC', 'Segoe UI', 'Microsoft YaHei', sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
            color: var(--dark-color);
            line-height: 1.6;
            min-height: 100vh;
            padding: 2rem 0;
        }
        
        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 0 1.5rem;
            animation: fadeIn 0.5s ease-out;
        }
        
        .header {
            text-align: center;
            margin-bottom: 3rem;
            position: relative;
        }
        
        .header h1 {
            color: var(--dark-color);
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 1rem;
            position: relative;
            display: inline-block;
        }
        
        .header h1::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 80px;
            height: 4px;
            background: var(--accent-color);
            border-radius: 2px;
        }
        
        .poll-list {
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            padding: 2.5rem;
            margin-bottom: 3rem;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .poll-list:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
        }
        
        .poll-list ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        
        .poll-item {
            padding: 1.25rem 0;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }
        
        .poll-item:last-child {
            border-bottom: none;
        }
        
        .poll-item:hover {
            background-color: rgba(72, 149, 239, 0.05);
            transform: translateX(5px);
        }
        
        .poll-link {
            display: flex;
            align-items: center;
            text-decoration: none;
            color: var(--dark-color);
            font-size: 1.15rem;
            font-weight: 500;
            transition: all 0.3s ease;
            position: relative;
            padding-left: 1.5rem;
        }
        
        .poll-link:hover {
            color: var(--primary-color);
        }
        
        .poll-link::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 8px;
            height: 8px;
            background: var(--accent-color);
            border-radius: 50%;
            transition: all 0.3s ease;
        }
        
        .poll-link:hover::before {
            width: 12px;
            height: 12px;
            background: var(--primary-color);
        }
        
        .no-polls {
            text-align: center;
            color: var(--gray-color);
            padding: 2.5rem 0;
            font-size: 1.1rem;
        }
        
        .admin-panel {
            display: flex;
            justify-content: center;
            gap: 1.5rem;
            margin-top: 2rem;
        }
        
        .action-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--dark-color);
            color: white;
            text-decoration: none;
            padding: 0.9rem 1.8rem;
            border-radius: 8px;
            font-weight: 500;
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        .action-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
            color: white;
        }
        
        .admin-link {
            background: var(--dark-color);
        }
        
        .admin-link:hover {
            background: #1a1b2e;
        }
        
        .create-link {
            background: var(--primary-color);
        }
        
        .create-link:hover {
            background: var(--secondary-color);
        }
        
        .footer {
            text-align: center;
            margin-top: 3rem;
            color: var(--gray-color);
            font-size: 0.9rem;
        }
        
        .footer p {
            margin-top: 1rem;
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 0 1rem;
            }
            
            .header h1 {
                font-size: 2rem;
            }
            
            .poll-list {
                padding: 1.5rem;
            }
            
            .admin-panel {
                flex-direction: column;
                gap: 1rem;
            }
            
            .action-button {
                width: 100%;
            }
        }
        
        @media (max-width: 480px) {
            body {
                padding: 1.5rem 0;
            }
            
            .header h1 {
                font-size: 1.8rem;
            }
            
            .poll-link {
                font-size: 1rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>请选择投票项目</h1>
            <p>参与您感兴趣的投票话题</p>
        </div>
        
        <div class="poll-list">
            {% if latest_question_list %}
                <ul>
                {% for question in latest_question_list %}
                    <li class="poll-item">
                        <a href="{% url 'polls:detail' question.id %}" class="poll-link">
                            {{ question.question_text }}
                        </a>
                    </li>
                {% endfor %}
                </ul>
            {% else %}
                <p class="no-polls">暂无可用投票</p>
            {% endif %}
        </div>
        
        <div class="admin-panel">
            <a href="/admin/" class="action-button admin-link">
                <i class="fas fa-cog"></i> 后台管理
            </a>
            <a href="/admin/polls/question/add/" class="action-button create-link">
                <i class="fas fa-plus"></i> 创建新投票
            </a>
        </div>
        
        <div class="footer">
            <p>© 2025 投票系统 | 所有权利保留</p>
        </div>
    </div>
    
    <!-- Font Awesome 图标库 -->
    <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
</body>
</html>